using System;
using System.Collections.ObjectModel;
using System.ComponentModel;

namespace MvvmFx.Common.ViewModels
{
    /// <summary>
    /// The ItemsEventArgs&lt;T&gt; class.
    /// </summary>
    /// <typeparam name="T">The argument &lt;T&gt; restricted to the base <see cref="ViewModelBase"/> class.</typeparam>
    public class ItemsEventArgs<T> : EventArgs where T : ViewModelBase
    {
        /// <summary>
        /// The items&lt;T&gt; field.
        /// </summary>
        private readonly Collection<T> items;

        /// <summary>
        /// Initializes a new instance of the <see cref="ItemsEventArgs{T}"/> class.
        /// </summary>
        /// <param name="items">The items&lt;T&gt; to add to the event args.</param>
        [System.Diagnostics.DebuggerStepThrough]
        public ItemsEventArgs(Collection<T> items)
        {
            this.items = items;
        }

        /// <summary>
        /// Gets the value of the <see cref="Items"/> property.
        /// </summary>
        public Collection<T> Items
        {
            get { return this.items; }
        }
    }

    /// <summary>
    /// The ItemPropertyChangedEventArgs class.
    /// </summary>
    /// <typeparam name="T">The argument &lt;T&gt; restricted to the base <see cref="ViewModelBase"/> class.</typeparam>
    public class ItemPropertyChangedEventArgs<T> : PropertyChangedEventArgs where T : ViewModelBase
    {
        /// <summary>
        /// The item&lt;T&gt; field.
        /// </summary>
        private readonly T item;

        /// <summary>
        /// Initializes a new instance of the <see cref="ItemPropertyChangedEventArgs{T}"/> class.
        /// </summary>
        /// <param name="item">The item&lt;T&gt; to add to the argument.</param>
        /// <param name="propertyName">The property name to add to the argument.</param>
        [System.Diagnostics.DebuggerStepThrough]
        public ItemPropertyChangedEventArgs(T item, String propertyName)
            : base(propertyName)
        {
            this.item = item;
        }

        /// <summary>
        /// Gets the value of the <see cref="Item"/> property.
        /// </summary>
        public T Item
        {
            get { return this.item; }
        }
    }
}